<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:facelets="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>

	<script type="text/javascript">
		('script')[0];
			s.parentNode.insertBefore(ga, s);
		})();

		var _gaq = _gaq || [];
		_gaq.push([ '_setAccount', 'UA-25161614-1' ]);
		_gaq.push([ '_trackPageview' ]);

		(function() {
			var ga = document.createElement('script');
			ga.type = 'text/javascript';
			ga.async = true;
			ga.src = ('https:' == document.location.protocol ? 'https://ssl'
					: 'http://www')
					+ '.google-analytics.com/ga.js';
			var s = document.getElementsByTagName
	</script>
	<link rel="stylesheet" href="/Poseidon/css/myStyle.css" type="text/css"
		media="all" />

</h:head>
<h:body>
	<h:form id="form">
	<p:growl id="growl" />
		<p:layoutUnit position="north" size="400" resizable="true"
			closable="true" collapsible="true">

			<p:layout style="min-width:400px;min-height:200px;" id="layout">

				<p:layoutUnit position="west" resizable="true" size="210"
					minSize="40" maxSize="210">
					<ui:include src="/pages/menu.xhtml" />

				</p:layoutUnit>

				<p:layoutUnit position="center">

					<h:panelGrid columns="1" cellpadding="3"
						style="width:40%;margin-left:25%;">
						<h:graphicImage url="/images/headers/agregar_act.png" />
						<p:panel id="panel">
							<h:panelGrid columns="4" cellpadding="5">
								<h:outputLabel for="firstname" value="Actividad: *" />
								<p:inputText id="firstname"
									requiredMessage="Este campo es obligatorio"
									value="#{tasksTableBean.selectedActivity.name}" required="true"
									size="30" label="Firstname">
								</p:inputText>
								<p:watermark for="firstname" value="Ingrese un nombre" />
								<p:message for="firstname" />

								<h:outputLabel for="description" value="Descripcion *"
									style="float:left" />

								<p:inputTextarea style="width:300px;height:100px;"
									effectDuration="400"
									requiredMessage="Este campo es obligatorio"
									value="#{tasksTableBean.selectedActivity.description}"
									required="true" label="description" id="description" />
								<p:watermark for="description" value="Ingrese una descripcion" />
								<p:message for="description" />


								<h:outputLabel for="startDate" value="Inicio: *" />
								<p:calendar id="startDate" binding="#{startDate}"
									value="#{tasksTableBean.selectedActivity.startDate}"
									pattern="dd/MM/yyyy" />
								<p:watermark for="startDate" value="Fecha de Inicio" />
								<p:message for="startDate" />

								<h:outputLabel for="finishDate" value="Fin *" />
								<p:calendar id="finishDate"
									value="#{tasksTableBean.selectedActivity.finishDate}"
									pattern="dd/MM/yyyy">
									<f:validator validatorId="activityValidator" />
									<f:attribute name="startDate" value="#{startDate}" />

								</p:calendar>
								<p:watermark for="finishDate" value="Fecha de Finalizacion" />
							    <p:message for="finishDate" />

								<h:outputLabel for="select" value="Responsable : *" />
								<p:selectOneMenu
									value="#{tasksTableBean.selectedActivity.employeeCreator}"
									style="width:200px" converter="employeeConverter" id="select"
									effect="fade" var="p">
									<f:selectItems id="employee"
										value="#{tasksTableBean.employees}" var="employee"
										itemLabel="#{employee.firstname}" itemValue="#{employee}" />

									<p:column>
										<p:graphicImage value="/#{p.image}" width="40" height="60" />
									</p:column>

									<p:column>  
         			       #{p.firstname}   
            			</p:column>
								</p:selectOneMenu>

							</h:panelGrid>

							<p:commandButton value="Guardar" ajax="false"
								actionListener="#{tasksTableBean.saveActivity}"
								action="dashboard?faces-redirect=true" />
							<p:commandButton value="Volver" ajax="false"
								action="dashboard?faces-redirect=true" immediate="true" />
						</p:panel>
					</h:panelGrid>
				</p:layoutUnit>
			</p:layout>
		</p:layoutUnit>
	</h:form>

</h:body>
</html>